module DrunkenMaster
  module Util
    class CamelCase
      def self.from string
        # very nice one liner, thanks ezra! mailto:ez@engineyard.com
        string.gsub(/\B[A-Z]/, '_\&').downcase
      end

      def self.to string
        return if string.nil?
        return '' if string == ''
        string.gsub(/(^.?|_.)/) { |m| m[-1,1].upcase }
      end
    end
  end
end